<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSeparateTimeLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // 不加索引，同步到clickhouse查询
        Schema::connection('mysqlDataStatistics')->create('separate_time_logs', function (Blueprint $table) {
            $table->id();
            $table->dateTime('startTime');
            $table->dateTime('endTime');
            $table->tinyInteger('type')->default(0)->comment('0:MySQL 1:Clickhouse');
            $table->string('path', '96')->default('')->comment('请求路径');
            $table->unsignedInteger('createdAt');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::connection('mysqlDataStatistics')->dropIfExists('separate_time_logs');
    }
}
